<template>
    <div>
        <span class="title">房源分配</span>
        <div class="flex-container">
            <!-- 第一个大卡片 -->
            <el-card class="card" style="margin-top: 10px; margin-left: 1px">
                <div slot="header" class="clearfix">
                </div>
                <div class="flex-container">
                    <!-- 第一个本科生人数卡片 -->
                    <el-card class="sub-card">
                            <span>本科生人数</span>
                        <div class="k1n1">
                            <span>126560</span>
                        </div>
                        <div v-for="o in 1" :key="o" class="k1n2">
                            {{'学生学籍状态为在籍在校'}}
                        </div>
                        <div class="gap1"></div>
                        <div v-for="o in 1" :key="o" class="k1n3">
                            <span>入住人数</span>
                            <span>未入住人数</span>
                        </div>
                        <div v-for="o in 1" :key="o" class="k1n4">
                            <span>12600</span>
                            <span>560</span>
                        </div>
                    </el-card>

                    <!-- 间隔 -->
                    <div class="gap"></div>

                    <!-- 第二个本科生人数卡片 -->
                    <el-card class="sub-card">
                            <span>本科生人数</span>
                        <div class="app"></div>
                        <div v-for="o in 1" :key="o" class="k1n1">
                            {{106560}}
                        </div>
                        <div v-for="o in 1" :key="o" class="k1n2">
                            {{'学生学籍状态为在籍在校'}}
                        </div>
                        <div v-for="o in 1" :key="o" class="k1n3">
                            <span>入住人数</span>
                            <span>未入住人数</span>
                        </div>
                        <div v-for="o in 1" :key="o" class="k1n4">
                            <span>12600</span>
                            <span>560</span>
                        </div>
                    </el-card>
                </div>
            </el-card>

            <!-- 第二个大卡片 -->
            <el-card class="big-card" style="margin-top: 10px; margin-left: 10px">
                <div slot="header" class="clearfix">
                    <span>分配说明</span>
                </div>
                <div v-for="o in 1" :key="o" class="textitem">
                    {{
                    '由于学校信息化建设不断推进，原“住宿管理”系统已经不能够完全满足多学生类型的住宿管理信息化支持。先将升级房源基建相关的功能独立，完善基建功能以便后期整合所有住宿资源、优化分配、合理分配，决策分析、2D建模、3D建模、AR等广度使用场景，并促使学校住宿信息化步入数字化。'
                    }}
                </div>
                <div v-for="o in 1" :key="o" class="textitem">
                    {{ '房源分配数据来源于现行住宿管理中空闲床位进行学生类型划分（本科生、研究生...），通过各学生类型住宿管理中可释放床位占用。' }}
                </div>
            </el-card>
        </div>
        <!-- 第三个大卡片 -->
        <div class="newbig">
        <el-card class="card1" style="margin-top: 10px; margin-left: 1px">
            <div slot="header" class="clearfix">
            </div>
            <div class="flex-container">
                <!-- 本科生卡片 -->
                <el-card class="sub-card1">
                    <div slot="header">
                        <span style="font-weight: 700;font-size: 16px;text-align: left;color: #fff;">本科生空闲床位</span>
                    </div>
                    <div v-for="o in 1" :key="o" class="k2n1">
                        <span style="margin-left: 40px">301</span>
                        <span style="font-weight: 700;
                        font-size: 19px;
                        text-align: left;
                        color: #fff;">个</span>
                    </div>
                    <div>
                        <span style="font-size: 14px; color: #fff;margin-left: 50px">本科生正在使用床位</span>
                    </div>
                    <div>
                        <span style="font-weight: 700; font-size: 36px; text-align: left; color: #fff;margin-left: 50px">12600</span>
                        <span style="font-weight: 400; font-size: 14px; text-align: left; color: #fff;">个</span>
                    </div>
                </el-card>

                <!-- 间隔 -->
                <div class="gap"></div>

                <!-- 研究生卡片 -->
                <el-card class="sub-card2">
                    <div slot="header">
                        <span style="font-weight: 700;font-size: 16px;text-align: left;color: #fff;">研究生空闲床位</span>
                    </div>
                    <div v-for="o in 1" :key="o" class="k2n1">
                        <span>1000</span>
                        <span style="font-weight: 700;
                        font-size: 19px;
                        text-align: left;
                        color: #fff;">个</span>
                    </div>
                    <div>
                        <span style="font-size: 14px; color: #fff;margin-left: 50px">本科生正在使用床位</span>
                    </div>
                    <div>
                        <span style="font-weight: 700; font-size: 36px; text-align: left; color: #fff;margin-left: 50px">12600</span>
                        <span style="font-weight: 400; font-size: 14px; text-align: left; color: #fff;">个</span>
                    </div>
                </el-card>
            </div>
        </el-card>
        <!-- 第四个大卡片-->
        <el-card class="card2" style="margin-top: 10px; margin-left: 10px">
                <span>当前可调配床位</span>
            <div class="vv"></div>
            <div>
                <span class="po">1301</span>
                <span class="op">个</span>
            </div>
            <div class="dang">当前数据发生变动说明，存在学生入住申请成功、住宿管理员统一分配</div>
            <div style="margin-top: 20px">
                <el-button @click="gotoHome" style="width: 400px; height: 90px">开始分配</el-button>
            </div>
        </el-card>
        </div>
    </div>
</template>
<script>
import axios from 'axios'

export default {
  name: 'Fifth',
  data () {
    return {
      bedCounts: []
    }
  },
  methods: {
    gotoHome () {
      this.$message.info('hello')
      this.$router.push('/sixth')
    },
    fetchBedCounts () {
      // 调用后端API接口，这里假设使用axios库发送HTTP请求
      axios.get('/api/bedcounts') // 替换为您的后端API接口路径
        .then(response => {
          this.bedCounts = response.data // 将返回的数据存储在组件的数据属性中
        })
        .catch(error => {
          console.error('Error fetching bed counts:', error)
        })
    }
  },
  created () {
    // 在组件创建时调用后端接口，获取数据
    this.fetchBedCounts()
  }
}
</script>
<style scoped>
.text {
    font-size: 14px;
}

.item {
    margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
    display: table;
    content: "";
}

.clearfix:after {
    clear: both
}

.big-card {
    width: 33%;
    height: auto;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #d1dbf5;
    margin-right: 20px; /* 可根据需要调整大卡片之间的间距 */
}

.card {
    width: 66%;
    height: 460px;
    border-radius: 6px;
    background: #fff;
// display: block;
}
.card1{
    width: 55%;
    height: 464px;
    border-radius: 6px;
    background: #fff;
}
.card2{
    width: 45%;
    height: 464px;
    border-radius: 6px;
    background: #fff;
}
.sub-card {
    flex: 1; /* 让每个子卡片平分父容器的宽度 */
    margin-right: 10px; /* 可根据需要调整子卡片之间的间距 */
}
.sub-card1{
    flex: 1; /* 让每个子卡片平分父容器的宽度 */
    margin-right: 10px; /* 可根据需要调整子卡片之间的间距 */
    background-image: url("../../../../assets/images/total/nihao.png");
}
.sub-card2{
    flex: 1; /* 让每个子卡片平分父容器的宽度 */
    margin-right: 10px; /* 可根据需要调整子卡片之间的间距 */
    background-image: url("../../../../assets/images/total/hello.png");
}
.gap {
    width: 20px; /* 间隔宽度 */
}
.gap1{
    width: 60px;
}

.flex-container {
    display: flex;
    margin-bottom: 20px; /* 可根据需要调整行与行之间的间距 */
}
.newbig{
    display: flex;
    margin-bottom: 20px;
}
. {
    color: #808080;
    font-size: 16px;
    font-face: Source Han Sans CN;
    font-weight: 700;
    letter-spacing: 0;
}

.title {
    width: 20px;
    height: 10px;
    color: #1a1a1a;
    font-size: 16px;
    font-face: Source Han Sans CN;
    font-weight: 700;
    letter-spacing: 0;
}

.sub-card {
    width: 492px;
    height: 387px;
    border-radius: 6px;
    border: 1px solid #d1dbf5;
    background: url("../../../../assets/images/total/img_1.png") center calc(100% + 0px)/cover,
linear-gradient(180.00deg, #236cff 0%, #3376ff 100%);
}

.big-card {
    width: 470px;
    height: 464px;
    border-radius: 6px;
    background: #fff;
}

.textitem {
    width: 350px;
    height: 120px;
    font-family: "Source Han Sans CN";
    font-weight: 400;
    font-size: 14px;
    text-align: left;
    color: #1a1a1a;
}
.po{
    font-family: "DIN Bold";
    font-weight: 700;
    font-size: 89px;
    text-align: left;
    color: #275ce6;
}
.op{
    font-family: "Source Han Sans CN Bold";
    font-weight: 700;
    font-size: 19px;
    text-align: left;
    color: #000;
}
.dang{
    font-family: "Source Han Sans CN";
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    color: #808080;
}
.k1n1{
    font-family: "DIN Bold";
    font-weight: 700;
    font-size: 50px;
    text-align: left;
    color: #1a1a1a;
}
.k1n2{
    font-family: "Source Han Sans CN";
    font-weight: 400;
    font-size: 14px;
    text-align: left;
    color: #808080;
}
.k1n3{
    font-family: "Source Han Sans CN";
    font-weight: 400;
    font-size: 14px;
    text-align: left;
    color: #808080;
}
.k1n4{
    font-family: "DIN Bold";
    font-weight: 700;
    font-size: 36px;
    text-align: left;
    color: #1a1a1a;
}
.k2n1 {
    font-family: "DIN Bold";
    font-weight: 700;
    font-size: 80px;
    text-align: left;
    color: #fff;
}
.vv{
    width: 210px;
    height: 210px;
    background: transparent;
    margin-left: 300px;
}
</style>
